﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WinForm02
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //“确定”按钮的单击事件，用于判断注册信息并跳转到新窗口显示注册信息
            string name = textBox1.Text;
            string pwd = textBox2.Text;
            string repwd = textBox3.Text;

            name = "小波";
            pwd = "0324";
            if (string.IsNullOrEmpty(name))
            {
                MessageBox.Show("用户名不能为空！");
                return;
            }
            else if (string.IsNullOrEmpty(textBox2.Text))
            {
                MessageBox.Show("密码不能为空！");
                return;
            }
            else if (!textBox2.Text.Equals(textBox3.Text))
            {
                MessageBox.Show("两次输入的密码不一致！");
                return;
            }
            if (textBox1.Text == name && textBox2.Text == pwd && textBox3.Text == repwd)
            {
               DialogResult dr =  MessageBox.Show("登陆成功","登录",MessageBoxButtons.OK,MessageBoxIcon.Information);
                //if (dr == DialogResult.OK)
                //{
                    
                //}

            }
            else
            {
                DialogResult dt = MessageBox.Show("登陆失败,是否退出重试？", "退出", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dt == DialogResult.Yes)
                {
                    Application.Exit();
                }
            }
        }

        //“注册”按钮的事件
        private void button2_Click(object sender, EventArgs e)
        {
            Form2 f2 = new Form2();
            this.Hide();
            f2.ShowDialog();  
        }
        private void button3_Click_1(object sender, EventArgs e)
        {
            //关闭窗体
            this.Close();
        }
        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }
        private void textBox3_TextChanged(object sender, EventArgs e)
        {

        }

   
    }
    }
